package cn.wolfcode.luowowo.hotel.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

@Setter
@Getter
public class HotelQueryObject extends QueryObject{
    private Long iMddId =-1L;  //目的地id
    private int state =-1;  //状态

    private Long iAreaId =-1L;  //区域id
    private String priceStr ;  //
    private Integer min ;  //最小价格
    private Integer max;  //最大价格
    private String sSortType = "hot";   //排序属性
    private String sSortFlag = "DESC";   //升降序
    private String sKeyWord;

    private Long themeId=-1L ;  //主题id
    private Long star ;  //
    private Long brandId ;  //品牌id

    public Integer getMin() {
        if (!StringUtils.hasLength(priceStr)) {
            return null;
        }
        String[] strs = priceStr.split("[¥-]");
        return Integer.parseInt(strs[1].trim());
    }
    public Integer getMax() {
        if (!StringUtils.hasLength(priceStr)) {
            return null;
        }
        String[] strs = priceStr.split("[¥-]");
        return Integer.parseInt(strs[2].trim());
    }

    public String getSSortType() {
        return ("price".equals(sSortType)?"ctripPrice":sSortType);
    }

    /*
iMddId
iAreaId: -1
iRegionId: -1
iPoiId:
position_name:
nLat: 0
nLng: 0
iDistance: 10000
sCheckIn: 2019-08-09
sCheckOut: 2019-09-05
iAdultsNum: 2
iChildrenNum: 0
sChildrenAge:
iPriceMin:
iPriceMax:
sTags:
sSortType: comment
sSortFlag: DESC
has_booking_rooms: 1
has_faved: 0
sKeyWord:
    * */
}
